﻿using System;

namespace Ndns.Packet.Abstractions.ResourceRecords
{
    public sealed class DnsResourceRecordNS : DnsResourceRecord
    {

        public override DnsHostName HostName { get; set; }
        public override DnsRecordType Type { get => DnsRecordType.NS; protected set => throw new NotSupportedException(); }
        public override DnsClass Class { get; protected set; }

        /// <summary>
        /// 表示应答中的CNAME记录。
        /// </summary>
        public DnsHostName NameServerHostName { get; set; }

        public DnsResourceRecordNS(DnsHostName hostName, DnsClass c, uint ttl)
            : base(hostName, c, ttl)
        {
        }


        /// <summary>
        /// 根据相关信息构造DnsResourceRecordNS实例。
        /// </summary>
        /// <param name="hostName">DNS应答的主机名信息。</param>
        /// <param name="c">DNS应答的类别。</param>
        /// <param name="ttl">DNS应答的超时时间。</param>
        /// <param name="nameServerHostName">DNS应答的数据。</param>
        public DnsResourceRecordNS(DnsHostName hostName, DnsClass c, uint ttl, DnsHostName nameServerHostName)
            : base(hostName, c, ttl)
        {
            NameServerHostName = nameServerHostName;
        }
        
        public override DnsResourceRecord Clone()
        {
            return new DnsResourceRecordNS(HostName, Class, TTL, NameServerHostName);
        }
        
    }
}
